﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BOOKSTORE.DATA.Models
{
  public  class SachManager
    {
      DatabaseContext db = new DatabaseContext();
      public List<Sach> sv_GetAll()
      {
          return db.BookstoreContext.Saches.ToList();
      }
      public List<Sach> sv_GetByCategogyID( int categoryID)
      {
          return db.BookstoreContext.Saches.Where(m => m.IdDanhMuc == categoryID).ToList();
      }

      public Sach sv_GetByID(int ID)
      {
          return db.BookstoreContext.Saches.Where(m => m.Id == ID).FirstOrDefault();
      }

      //public List<Sach> sv_GetListSearch(string name)
      //{
      //   // return db.BookstoreContext.Saches.Where(m => m.IdDanhMuc == categoryID).ToList();
      //}
  }

}
